home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / i-cpotim.ads < prev    next >
Text File  |  1996-01-30  |  4KB  |  80 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --             I N T E R F A C E S . C . P O S I X _ T I M E R S            --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.3 $                             --
  10. --                                                                          --
  11. --       Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved        --
  12. --                                                                          --
  13. -- GNARL is free software; you can redistribute it  and/or modify it  under --
  14. -- terms  of  the  GNU  Library General Public License  as published by the --
  15. -- Free Software  Foundation;  either version 2, or (at  your  option)  any --
  16. -- later  version.  GNARL is distributed  in the hope that  it will be use- --
  17. -- ful, but but WITHOUT ANY WARRANTY;  without even the implied warranty of --
  18. -- MERCHANTABILITY  or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. -- eral Library Public License  for more details.  You should have received --
  20. -- a  copy of the GNU Library General Public License along with GNARL;  see --
  21. -- file COPYING.LIB.  If not,  write to the  Free Software Foundation,  675 --
  22. -- Mass Ave, Cambridge, MA 02139, USA.                                      --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. with Interfaces.C.POSIX_Error; use Interfaces.C.POSIX_Error;
  27. --  Used for Return_Code
  28.  
  29. package Interfaces.C.POSIX_Timers is
  30.  
  31.    type time_t is new long;
  32.  
  33.    type Nanoseconds is new long;
  34.  
  35.    subtype Fractional_Second is Nanoseconds range 0 .. 10#1#E9 - 1;
  36.    --  This is dependent on the stdtypes.h header file.
  37.  
  38.    type timespec is record
  39.       tv_sec : time_t;
  40.       tv_nsec : Fractional_Second;
  41.    end record;
  42.  
  43.    timespec_First : constant timespec :=
  44.      timespec' (time_t'First, Fractional_Second'First);
  45.  
  46.    timespec_Last : constant timespec :=
  47.      timespec' (time_t'Last, Fractional_Second'Last);
  48.  
  49.    timespec_Zero : constant timespec :=
  50.      timespec' (time_t'First, Fractional_Second'First);
  51.  
  52.    timespec_Unit : constant timespec :=
  53.      timespec' (time_t'First, Fractional_Second'First + 1);
  54.    --  This is dependent on the POSIX.4 implementation; the draft standard
  55.    --  only says that fields of these names and types (with Integer for long)
  56.    --  will be in the record.  There may be other fields, and these do not
  57.    --  have to be in the indicated position.  This should really be done by
  58.    --  getting the sizes and offsets using get_POSIX_Constants and building
  59.    --  the record to match using representation clauses.
  60.  
  61.    --  temporarily, should really only be for 1???
  62.    type clock_id_t is private;
  63.  
  64.    CLOCK_REALTIME : constant clock_id_t;
  65.  
  66.    procedure clock_gettime
  67.      (ID     : clock_id_t;
  68.       CT     : out timespec;
  69.       Result : out Return_Code);
  70.  
  71. private
  72.  
  73.    type clock_id_t is new long;
  74.    --  This clock_id_t is defined as an long in POSIX
  75.  
  76.    CLOCK_REALTIME : constant clock_id_t := 0;
  77.    --  We currently implement only Realtime clock.
  78.  
  79. end Interfaces.C.POSIX_Timers;
  80.